home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / system / stpfcb12.zip / STOPFCBS.BAS < prev    next >
BASIC Source File  |  1991-05-27  |  5KB  |  131 lines

  1. ' STOPFCBS is Copyright 1991 by Alex Boge
  2.  
  3. ' Version 1.00  May 9, 1991
  4. ' Version 1.01  May 10, 1991 - Remove Deinstall functions, remove help,
  5. '  check to see if SHARE was loaded before installing, trap more functions and
  6. '  compile for 286 or better only.
  7. ' Version 1.10  May 23, 1991 - YIPES, big boo-boo.  Program was developed
  8. '  and tested under 4DOS instead of COMMAND.COM, so I didn't "know" that
  9. '  COMMAND.COM uses FCB functions 13H & 17H.  Had to drop these!
  10. ' Version 1.20  May 27, 1991 - STOPFCBS now uses Int 2Fh to return true for
  11. '  installed state of SHARE.  This prevents multiple installs of STOPFCBS
  12. '  and also prevents SHARE from being loaded afterwards.
  13.  
  14. ' This program stops INT 21H FCB-Oriented Functions 0FH and 16H
  15. ' from causing harm to BIGDOS partitions.
  16.  
  17. ' Linked with BASIC PDS v7.10 and P.D.Q. 2.18 as follows:
  18. ' BC /O /G2 STOPFCBS;
  19. ' LINK /NOD /NOE STOPFCBS STR00256 _NOERROR _NOREAD _NOVAL,,NUL,BASIC7 PDQ;
  20.  
  21. DEFINT A-Z
  22.  
  23. TYPE RegType
  24.      AX        AS INTEGER
  25.      BX        AS INTEGER
  26.      CX        AS INTEGER
  27.      DX        AS INTEGER
  28.      BP        AS INTEGER
  29.      SI        AS INTEGER
  30.      DI        AS INTEGER
  31.      Flags     AS INTEGER
  32.      DS        AS INTEGER
  33.      ES        AS INTEGER
  34.      SS        AS INTEGER
  35.      SP        AS INTEGER
  36.      BusyFlag  AS INTEGER
  37.      Address   AS INTEGER
  38.      Segment   AS INTEGER
  39.      ProcAdr   AS INTEGER
  40.      ProcSeg   AS INTEGER
  41.      IntNum    AS INTEGER
  42. END TYPE
  43. DIM Registers21 AS RegType
  44. DIM Registers2F AS RegType
  45.  
  46. DECLARE SUB EndTSR (ID$)
  47. DECLARE SUB GotoOldInt (Registers AS RegType)
  48. DECLARE SUB IntEntry1 ()
  49. DECLARE SUB IntEntry2 (Registers AS RegType, Action%)
  50. DECLARE SUB Interrupt (IntNumber, Registers AS ANY)
  51. DECLARE SUB Pause (Ticks%)
  52. DECLARE SUB PDQPrint (Work$, Row%, Column%, Colr%)
  53. DECLARE SUB PointIntHere (Registers AS RegType)
  54. DECLARE SUB ReturnFromInt (Registers AS RegType)
  55.  
  56. ID$ = "STOPFCBS Version 1.20"
  57.  
  58. PRINT ID$ + " (C) 1991 by Alex Boge."
  59.  
  60.  
  61. Registers2F.AX = &H1000 ' AH=&h10, AL=&h00 - Function to test for SHARE
  62. Interrupt &H2F, Registers2F ' So we get it! (returned in AL)
  63. IF (Registers2F.AX AND &HFF) = &HFF THEN
  64.    PRINT "SHARE or STOPFCBS has already been installed.": END
  65. END IF
  66.  
  67. PRINT "STOPFCBS installed - Intercepting INT 21h functions 0Fh and 16h."
  68. IF INSTR(UCASE$(COMMAND$), "/Q") THEN
  69.    Verbose = 0
  70.    PRINT "Message line will be suppressed - beep will sound during an intercept."
  71. ELSE
  72.    Verbose = -1
  73.    Message$ = "« STOPFCBS has intercepted INT 21h FCB-Oriented function "
  74. END IF
  75.  
  76. Registers21.IntNum = &H21 'specify trapping Int 21h
  77. PointIntHere Registers21  'load Registers with what it needs, and pass
  78. GOTO Multiplex            '  control to the next line at each Int. 21h
  79.  
  80.  
  81. '----- the code below receives control with each Interrupt 21h
  82.  
  83. IntEntry1                       'this is the first mandatory step
  84. IntEntry2 Registers21, 0        'and this is the second one
  85.  
  86. Service = Registers21.AX \ 256  'get the current service number in AH
  87.  
  88. 'open, delete, create & rename file using FCB
  89. IF Service = &HF OR Service = &H16 THEN
  90.    BEEP 'make noise
  91.    IF Verbose THEN 'if we are allowed
  92.       DEF SEG = 0: V = PEEK(&H449): DEF SEG 'get video mode
  93.       IF V < 4 OR V = 7 THEN PDQPrint Message$ + HEX$(Service) + "h »", 1, 1, 15 'only in text mode
  94.       Pause 36 'pause about 2 seconds
  95.    END IF
  96.    Registers21.AX = Service * 256 + &HFF 'return fail code
  97.    ReturnFromInt Registers21 'finished
  98. ELSE
  99.    GotoOldInt Registers21 'on to original Int 21h if we're not trapping
  100. END IF
  101. '--- END Int 21h
  102.  
  103. Multiplex:
  104. Registers2F.IntNum = &H2F 'specify trapping Int 21h
  105. PointIntHere Registers2F  'load Registers with what it needs, and pass
  106. GOTO GoRes                '  control to the next line at each Int. 2Fh
  107.  
  108.  
  109. '----- the code below receives control with each Interrupt 2Fh
  110.  
  111. IntEntry1                       'this is the first mandatory step
  112. IntEntry2 Registers2F, 0        'and this is the second one
  113.  
  114. Proc = Registers2F.AX \ 256
  115. Func = Registers2F.AX AND 255
  116.  
  117. 'get installed state of SHARE:
  118. ' According to Programmers PC Source Book, Func=0, but real life shows
  119. ' that AL is &H80 so let's check for both to be safe
  120. IF Proc = &H10 AND (Func = 0 OR Func = &H80) THEN
  121.    Registers2F.AX = &H10FF 'indicate installed state
  122.    ReturnFromInt Registers2F 'finished
  123. ELSE
  124.    GotoOldInt Registers2F 'on to original Int 2Fh if we're not trapping
  125. END IF
  126. '----- END Int 2Fh
  127.  
  128. GoRes:
  129. EndTSR ID$  'terminate and stay resident
  130.  
  131.